package com.hpradip.android.accessNumberSpeedDialer;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class NumbersAdapter extends ArrayAdapter<String> {

	private Context context;
	private LayoutInflater inflater;

	public NumbersAdapter(Context context,
			int textViewResourceId, String[] objects) {
		super(context, textViewResourceId, objects);
		this.context = context;
		this.inflater = LayoutInflater.from(context);
	}
	
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	View v = convertView;
	if (v == null) {
		v = inflater.inflate(R.layout.number_list_item, null);
	}
	
	String number = getItem(position);
	if (number == null)
		return v;
	
	TextView numbersView = (TextView)v.findViewById(R.id.number_text);
	numbersView.setText(number);
	
	return v;
}
}
